//Tuesday, November 03 2009
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class TheLuckyString
{
	public:
		int count(string s)
		{
			int cnt = 0;
			vector<char> v;
			for(int i=0; i<s.length(); i++)
				v.push_back(s[i]);
			sort(v.begin(), v.end());
			do
			{
				if(check(v))
					cnt ++;
			}
			while(next_permutation(v.begin(), v.end()));
			return cnt;
		}
		bool check(vector<char> v)
		{
			for(int i=1; i<v.size(); i++)
				if(v[i] == v[i-1]) return false;
			return true;
		}
};
